<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" href="/webjars/bootstrap/3.3.7-1/css/bootstrap.min.css" />
    <script src="https://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.2.min.js"/>
    <script src="/webjars/bootstrap/3.3.7-1/js/bootstrap.min.js"></script>
</head>
<body>
<form>
    <p>账号：<input name="username" type="text" id="username"/></p>
    <p>密码：<input name="password" type="password" id="password"/></p>
    <p><input type="button" id="ajaxLogin" value="登录" /></p>
</form>
</body>
<script type="text/javascript">

    $("#ajaxLogin").click(function() {
        var username = $("#username").val();
        var password = $("#password").val();

        $.ajax({
            type:"post",
            url:"sys/login",
            data:JSON.stringify({
                "username" : username,
                "password" : password
            }),
            contentType: 'application/json',
            success:function(result){
                console.log("result code="+result.code);
                location.href = "/";
                /*if (result.code == 200) {

                } else {
                    $("#errMsg").html(result.message);
                }*/
            }
        });
    });
</script>
</html>